package com.bb.blog.code.threading.example.atomic;

import sun.misc.Unsafe;

import java.lang.reflect.Field;


/**
 * unsafe
 * 1.数组相关
 *
 */
public class UnsafeExample {
    public static Unsafe getUnsafe(){
        try{
            Field field = Unsafe.class.getDeclaredField("theUnsafe");
            field.setAccessible(true);
            Unsafe theUnsafe = (Unsafe) field.get(null);
            return theUnsafe;
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}
